package main

import "fmt"

func PrintAllSubsquences(s string) []string {
	// 求字符串全部子序列
	runeSlice := []rune(s) // 将字符串转换为字符数组

	// 打印字符数组
	fmt.Println("字符数组:", runeSlice)
	var res []string

	process(runeSlice, 0, &res, "")

	return res
}

func process(array []rune, index int, res *[]string, path string) {

	if index == len(array) {
		*res = append(*res, path)
		return
	}

	process(array, index+1, res, path)
	process(array, index+1, res, path+string(array[index]))
}

func main() {
	res := PrintAllSubsquences("cdv")
	fmt.Println("a", res)
}
